﻿Public Class xtf_LISTADOkilosemanal_

    Public Overrides Sub IniciarLista()
        Try
            gdc_general.BeginUpdate()
            gdc_general.DataSource = dtt_DataTable
            'ulg_Lista.DisplayLayout.GroupByBox.Style = Infragistics.Win.UltraWinGrid.GroupByBoxStyle.Full

            'Creacion y carga de Cuentas
            dtt_DataTable.Columns.Add("Identificador (ID)")
            dtt_DataTable.Columns.Add("Fecha")
            dtt_DataTable.Columns.Add("Cantidad")
            dtt_DataTable.Columns.Add("Importe")

            gdv_general.PopulateColumns(dtt_DataTable)

            Dim obj_kilosemanal_ As New cls_kilosemanal_
            If obj_kilosemanal_.CargarTodos(ObtenerRegistroEstado) Then
                For Each kilosemanal As cls_kilosemanal_ In obj_kilosemanal_.Items
                    AgregarItem(kilosemanal)
                Next
            End If
            'ulg_Lista.DataBind()

            FiltrarColumnas()
            gdc_general.EndUpdate()
        Catch ex As Exception
            'Dim frmError As New frm_ErrorManager(ex.Message)
        End Try
    End Sub

    Public Function AgregarItem(ByRef kilosemanal As cls_kilosemanal_) As DataRow
        Dim Row As DataRow = dtt_DataTable.NewRow
        Row("Identificador (ID)") = kilosemanal.idkilosemanal
        Row("Fecha") = kilosemanal.fecha.Date.ToShortDateString
        Row("Cantidad") = kilosemanal.kilos
        Row("Importe") = kilosemanal.importe

        dtt_DataTable.Rows.Add(Row)
        'ulg_Lista.Rows(ulg_Lista.Rows.Count - 1).Height = 19
        Return Row
    End Function

    Public Sub ModificarItem(ByRef kilosemanal As cls_kilosemanal_, ByRef ulg_row As DataRow)
        ulg_row("Identificador (ID)") = kilosemanal.idkilosemanal
        ulg_row("Fecha") = kilosemanal.fecha.Date.ToShortDateString
        ulg_row("Cantidad") = kilosemanal.kilos
        ulg_row("Importe") = kilosemanal.importe
    End Sub

    Public Sub New()

        Me.Cursor = Cursors.WaitCursor
        InitializeComponent()
        PERMISONuevo = "001005002"
        PERMISOModificar = "001005003"
        PERMISOEliminar = "001005004"
        PERMISOImprimir = "001005005"
        Me.Text = lbl_modulo.Text : lbl_modulodescripcion.Text = "Listado de " & lbl_modulo.Text & "."
        IniciarLista()
        Me.Cursor = Cursors.Default

    End Sub
End Class